<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>计算圆的周长和面积</title>
	</head>
	<body>
		<p>半径：<input type="text" id="r" /></p>
		<p>周长：<input type="text" id="c" /></p>
		<p>面积：<input type="text" id="s" /></p>
		<script>
			var r = prompt('请输入圆的半径');
			r = Number(r);
			p = Math.PI;
			if(!isNaN(r)) {
			document.querySelector('#r').value = r;
				document.querySelector('#c').value = 2 * p * 2;
				document.querySelector('#s').value = p * r * r;
			} else {
				alert('请输入数值');
			}
		</script>
	</body>
</html>
